package com.training.permission.action.chengshu;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.training.permission.service.chengshu.IPermissionService;

@SuppressWarnings("serial")
public class DelPermissionAction extends ActionSupport {
	private IPermissionService permissionService;
	private List<String> selectID;

	public List<String> getSelectID() {
		return selectID;
	}


	public void setSelectID(List<String> selectID) {
		this.selectID = selectID;
	}


	public void setPermissionService(IPermissionService permissionService) {
		this.permissionService = permissionService;
	}


	public String execute(){
		List<Integer> id = new ArrayList<Integer>();
		for(String sel : selectID){
			System.out.println("传过来的序列是："+sel);
			id.add(Integer.parseInt(sel));
		}
		if(permissionService.delRole(id)){
			System.out.println("成功");
			this.addFieldError("delResult", "删除成功！");
		}else{
			System.out.println("失败");
			this.addFieldError("delResult", "删除失败！");
		}
		return SUCCESS;
	}
}
